#pragma once

#include "collection.h"
#include "tabcontrol.h"

/** 
 * \ingroup ti6
 *
 * \brief
 * The CollectionTab stores information specific for a collection tab page,
 * or, an opened collection. It is used by MainWindow's instance of
 * TabControl, to identify a tab page containing a collection.
 * The collection itself is showed by CollectionBox (which has a single
 * instance in the application).
 *
 * Copyright (c) Academie voor ICT en Media 2007 - 2008
 */
class CollectionTab: public TabControl::Tab
{
public:
	/**
	 \brief
	 Default constructor.
	 */
	CollectionTab();

	/**
	 \brief
	 Deconstructor.
	 */
	virtual ~CollectionTab();

	/**
	 \brief
	 Request whether the collection, which is open in this tab, has any unsaved changes.
	 
	 \return True is returned if there are unsaved changes. False is returned
	   otherwise.
	 */
	bool hasUnsavedChanges() const;

	/**
	 \brief
	 Set the unsaved changes flag. Set this to true if the collection is changed. When
	 changes are saved, the flag should be set to false.
	 
	 \param value The new value of the unsaved changes flag.
	 */
	void setHasUnsavedChanges( bool value );

	/**
	 \brief
	 Get the collection which is open in this tab.
	 
	 \return A pointer to the collection. Do not delete this value.
	 */
	Collection* collection();

	/**
	 \brief
	 Set the collection which is open in this tab. The CollectionTab instance will
	 take ownership of the specified collection.
	 
	 \param *c A pointer to the collection.
	 */
	void setCollection( Collection *c );

private:
	/**
	 The opened collection.
	 */
	Collection *_collection;

	/**
	 Unsaved changes flag.
	 */
	bool _hasUnsavedChanges;
};
